* Chage Directory to location of data file: an example below: *
cd "/Users/dlk265/Library/CloudStorage/Box-Box/Methods_Paper/Replication Files/"

* FIGURE 1A: ATTENTION FILTER PASSAGE RATES *
* Passed attention filter *
use "CFKK_Lucid_MC_Combined.dta", clear
gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .
* Reminder: 1 "Philippines" 2 "Nigeria" 3 "India" 4 "Brazil" 5 "Japan" 6 "USA", replace

reg passed_filter usa philippines nigeria japan india brazil [pw=weight_nocollege]  if survey_firm == "Lucid" , nocons
replace mean_lucidwt = r(table)[1,1] if inrange(counter, 0.79, 0.81)
replace mean_lucidwt = r(table)[1,2] if inrange(counter, 1.79, 1.81)
replace mean_lucidwt = r(table)[1,3] if inrange(counter, 2.79, 2.81)
replace mean_lucidwt = r(table)[1,4] if inrange(counter, 3.79, 3.81)
replace mean_lucidwt = r(table)[1,5] if inrange(counter, 4.79, 4.81)
replace mean_lucidwt = r(table)[1,6] if inrange(counter, 5.79, 5.81)
replace l_lucidwt = r(table)[5,1] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table)[5,2] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table)[5,3] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table)[5,4] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table)[5,5] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table)[5,6] if inrange(counter, 5.79, 5.81)
replace u_lucidwt = r(table)[6,1] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table)[6,2] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table)[6,3] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table)[6,4] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table)[6,5] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table)[6,6] if inrange(counter, 5.79, 5.81)

reg passed_filter usa philippines nigeria japan india brazil  if survey_firm == "Lucid", nocons
replace mean_lucid = r(table)[1,1] if inrange(counter, 0.89, 0.91)
replace mean_lucid = r(table)[1,2] if inrange(counter, 1.89, 1.91)
replace mean_lucid = r(table)[1,3] if inrange(counter, 2.89, 2.91)
replace mean_lucid = r(table)[1,4] if inrange(counter, 3.89, 3.91)
replace mean_lucid = r(table)[1,5] if inrange(counter, 4.89, 4.91)
replace mean_lucid = r(table)[1,6] if inrange(counter, 5.89, 5.91)
replace l_lucid = r(table)[5,1] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table)[5,2] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table)[5,3] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table)[5,4] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table)[5,5] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table)[5,6] if inrange(counter, 5.89, 5.91)
replace u_lucid = r(table)[6,1] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table)[6,2] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table)[6,3] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table)[6,4] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table)[6,5] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table)[6,6] if inrange(counter, 5.89, 5.91)

reg passed_filter usa philippines nigeria japan india brazil [pw=wts] if survey_firm == "Morning Consult", nocons
replace mean_mcwt = r(table)[1,1] if inrange(counter, .99, 1.01)
replace mean_mcwt = r(table)[1,2] if inrange(counter, 1.99, 2.01)
replace mean_mcwt = r(table)[1,3] if inrange(counter, 2.99, 3.01)
replace mean_mcwt = r(table)[1,4] if inrange(counter, 3.99, 4.01)
replace mean_mcwt = r(table)[1,5] if inrange(counter, 4.99, 5.01)
replace mean_mcwt = r(table)[1,6] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table)[5,1] if inrange(counter, .99, 1.01)
replace l_mcwt = r(table)[5,2] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table)[5,3] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table)[5,4] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table)[5,5] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table)[5,6] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table)[6,1] if inrange(counter, .99, 1.01)
replace u_mcwt = r(table)[6,2] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table)[6,3] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table)[6,4] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table)[6,5] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table)[6,6] if inrange(counter, 5.99, 6.01)

reg passed_filter usa philippines nigeria japan india brazil  if survey_firm == "Morning Consult", nocons
replace mean_mc = r(table)[1,1] if inrange(counter, 1.09, 1.11)
replace mean_mc = r(table)[1,2] if inrange(counter, 2.09, 2.11)
replace mean_mc = r(table)[1,3] if inrange(counter, 3.09, 3.11)
replace mean_mc = r(table)[1,4] if inrange(counter, 4.09, 4.11)
replace mean_mc = r(table)[1,5] if inrange(counter, 5.09, 5.11)
replace mean_mc = r(table)[1,6] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table)[5,1] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table)[5,2] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table)[5,3] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table)[5,4] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table)[5,5] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table)[5,6] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table)[6,1] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table)[6,2] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table)[6,3] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table)[6,4] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table)[6,5] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table)[6,6] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway  (scatter counter mean_mc , msymbol(triangle) mcolor(stc3)) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1))  (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), xlabel(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%") xti("% Passed Attention Filter") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) yti("") ti("") scale(.85)  legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) saving(attention.gph, replace)

* FIGURE 1B: Frequency of Survey Taking: One or more per day on average *
use "CFKK_Lucid_MC_Combined.dta", clear
gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

reg frequencies4 usa philippines nigeria japan india brazil [pw=weight_nocollege]  if survey_firm == "Lucid" , nocons
replace mean_lucidwt = r(table)[1,1] if inrange(counter, 0.79, 0.81)
replace mean_lucidwt = r(table)[1,2] if inrange(counter, 1.79, 1.81)
replace mean_lucidwt = r(table)[1,3] if inrange(counter, 2.79, 2.81)
replace mean_lucidwt = r(table)[1,4] if inrange(counter, 3.79, 3.81)
replace mean_lucidwt = r(table)[1,5] if inrange(counter, 4.79, 4.81)
replace mean_lucidwt = r(table)[1,6] if inrange(counter, 5.79, 5.81)
replace l_lucidwt = r(table)[5,1] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table)[5,2] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table)[5,3] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table)[5,4] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table)[5,5] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table)[5,6] if inrange(counter, 5.79, 5.81)
replace u_lucidwt = r(table)[6,1] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table)[6,2] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table)[6,3] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table)[6,4] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table)[6,5] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table)[6,6] if inrange(counter, 5.79, 5.81)

reg frequencies4 usa philippines nigeria japan india brazil  if survey_firm == "Lucid", nocons
replace mean_lucid = r(table)[1,1] if inrange(counter, 0.89, 0.91)
replace mean_lucid = r(table)[1,2] if inrange(counter, 1.89, 1.91)
replace mean_lucid = r(table)[1,3] if inrange(counter, 2.89, 2.91)
replace mean_lucid = r(table)[1,4] if inrange(counter, 3.89, 3.91)
replace mean_lucid = r(table)[1,5] if inrange(counter, 4.89, 4.91)
replace mean_lucid = r(table)[1,6] if inrange(counter, 5.89, 5.91)
replace l_lucid = r(table)[5,1] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table)[5,2] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table)[5,3] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table)[5,4] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table)[5,5] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table)[5,6] if inrange(counter, 5.89, 5.91)
replace u_lucid = r(table)[6,1] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table)[6,2] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table)[6,3] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table)[6,4] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table)[6,5] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table)[6,6] if inrange(counter, 5.89, 5.91)

reg frequencies4 usa philippines nigeria japan india brazil [pw=wts] if survey_firm == "Morning Consult", nocons
replace mean_mcwt = r(table)[1,1] if inrange(counter, .99, 1.01)
replace mean_mcwt = r(table)[1,2] if inrange(counter, 1.99, 2.01)
replace mean_mcwt = r(table)[1,3] if inrange(counter, 2.99, 3.01)
replace mean_mcwt = r(table)[1,4] if inrange(counter, 3.99, 4.01)
replace mean_mcwt = r(table)[1,5] if inrange(counter, 4.99, 5.01)
replace mean_mcwt = r(table)[1,6] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table)[5,1] if inrange(counter, .99, 1.01)
replace l_mcwt = r(table)[5,2] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table)[5,3] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table)[5,4] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table)[5,5] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table)[5,6] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table)[6,1] if inrange(counter, .99, 1.01)
replace u_mcwt = r(table)[6,2] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table)[6,3] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table)[6,4] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table)[6,5] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table)[6,6] if inrange(counter, 5.99, 6.01)

reg frequencies4 usa philippines nigeria japan india brazil  if survey_firm == "Morning Consult", nocons
replace mean_mc = r(table)[1,1] if inrange(counter, 1.09, 1.11)
replace mean_mc = r(table)[1,2] if inrange(counter, 2.09, 2.11)
replace mean_mc = r(table)[1,3] if inrange(counter, 3.09, 3.11)
replace mean_mc = r(table)[1,4] if inrange(counter, 4.09, 4.11)
replace mean_mc = r(table)[1,5] if inrange(counter, 5.09, 5.11)
replace mean_mc = r(table)[1,6] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table)[5,1] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table)[5,2] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table)[5,3] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table)[5,4] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table)[5,5] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table)[5,6] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table)[6,1] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table)[6,2] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table)[6,3] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table)[6,4] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table)[6,5] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table)[6,6] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway  (scatter counter mean_mc , msymbol(triangle) mcolor(stc3)) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1))  (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), xlabel(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%") xti("% Taking >7 Surveys per Week") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) yti("") ti("") scale(.85)  legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) saving(frequency.gph, replace)

graph combine attention.gph frequency.gph, xsize(8.5) ysize(11) rows(2)

* FIGURE 2: COMPARATIVE DEMOGRAPHICS *
* The code for each figure panel is long, so in separate files. Combined here*
grc1leg2 percent_female.gph Median_ages_bootstrappedcis.gph percent_college.gph, rows(3) cols(1) xsize(8.5) ysize(11)
 
* Figure 3: Parties *
use "CKKF_parties_combined.dta", clear
gen obs_pos = counter
* Plot *
twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos pop , mcolor(black)   msymbol(circle)) ///
    (scatter obs_pos mc , mcolor(stc3) msymbol(triangle)) ///
    (scatter obs_pos mc_wt , mcolor(stc4) msymbol(square)) ///
    (scatter obs_pos lucid , mcolor(stc1) msymbol(diamond)) ///
	(scatter obs_pos lucid_wt , mcolor(stc2) msymbol(Sh)) ///
    , ///
    legend(order(2 "Population" 3 "MC" 4 "MC (Wt)" 5 "Lucid" 6 "Lucid (Wt)") pos(6) rows(1)) ///
	    xlabel(, grid) ///
    xtitle("% Vote") xlabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%" 60 "60%" 70 "70%") ///
	ylabel(84 "Brazil:PT" 78 "Brazil:PL" 69 "India:BJP" 63 "India:INC" 54 "Japan:LDP" 48 "Japan:CDP" 39 "Nigeria:APC" 33 "Nigeria:PDP" 24 "Philippines:PDP" 18 "Philippines:NP" 9 "USA:GOP" 3 "USA:Dem" ) ///
	yti("") scale(.7) saving(parties_comp.gph, replace) 
graph export "Christenson and Kriner corr 25-0199.R1 Figure 3.eps", replace 
graph export "Christenson and Kriner corr 25-0199.R1 Figure 3.tif", replace 

* Figure 4: Experimental Main Effects *
* Mayoral Corruption Treatment Effect *
use "CFKK_Lucid_MC_Combined.dta", clear

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

gen countries_new = .
replace countries_new = 1 if usa == 1
replace countries_new = 2 if philippines == 1
replace countries_new = 3 if nigeria == 1
replace countries_new = 4 if japan == 1
replace countries_new = 5 if india == 1
replace countries_new = 6 if brazil == 1

reg vote_mayor i.corruption_treatment##i.countries_new  [pw=weight_nocollege] if survey_firm == "Lucid"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_lucidwt = r(table)[1,7] if inrange(counter, 0.79, 0.81)
replace mean_lucidwt = r(table)[1,8] if inrange(counter, 1.79, 1.81)
replace mean_lucidwt = r(table)[1,9] if inrange(counter, 2.79, 2.81)
replace mean_lucidwt = r(table)[1,10] if inrange(counter, 3.79, 3.81)
replace mean_lucidwt = r(table)[1,11] if inrange(counter, 4.79, 4.81)
replace mean_lucidwt = r(table)[1,12] if inrange(counter, 5.79, 5.81)
replace l_lucidwt = r(table)[5,7] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table)[5,8] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table)[5,9] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table)[5,10] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table)[5,11] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table)[5,12] if inrange(counter, 5.79, 5.81)
replace u_lucidwt = r(table)[6,7] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table)[6,8] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table)[6,9] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table)[6,10] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table)[6,11] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table)[6,12] if inrange(counter, 5.79, 5.81)

reg vote_mayor i.corruption_treatment##i.countries_new  if survey_firm == "Lucid"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_lucid = r(table)[1,7] if inrange(counter, 0.89, 0.91)
replace mean_lucid = r(table)[1,8] if inrange(counter, 1.89, 1.91)
replace mean_lucid = r(table)[1,9] if inrange(counter, 2.89, 2.91)
replace mean_lucid = r(table)[1,10] if inrange(counter, 3.89, 3.91)
replace mean_lucid = r(table)[1,11] if inrange(counter, 4.89, 4.91)
replace mean_lucid = r(table)[1,12] if inrange(counter, 5.89, 5.91)
replace l_lucid = r(table)[5,7] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table)[5,8] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table)[5,9] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table)[5,10] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table)[5,11] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table)[5,12] if inrange(counter, 5.89, 5.91)
replace u_lucid = r(table)[6,7] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table)[6,8] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table)[6,9] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table)[6,10] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table)[6,11] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table)[6,12] if inrange(counter, 5.89, 5.91)

reg vote_mayor i.corruption_treatment##i.countries_new  [pw=wts]if survey_firm == "Morning Consult"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_mcwt = r(table)[1,7] if inrange(counter, .99, 1.01)
replace mean_mcwt = r(table)[1,8] if inrange(counter, 1.99, 2.01)
replace mean_mcwt = r(table)[1,9] if inrange(counter, 2.99, 3.01)
replace mean_mcwt = r(table)[1,10] if inrange(counter, 3.99, 4.01)
replace mean_mcwt = r(table)[1,11] if inrange(counter, 4.99, 5.01)
replace mean_mcwt = r(table)[1,12] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table)[5,7] if inrange(counter, .99, 1.01)
replace l_mcwt = r(table)[5,8] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table)[5,9] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table)[5,10] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table)[5,11] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table)[5,12] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table)[6,7] if inrange(counter, .99, 1.01)
replace u_mcwt = r(table)[6,8] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table)[6,9] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table)[6,10] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table)[6,11] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table)[6,12] if inrange(counter, 5.99, 6.01)

reg vote_mayor i.corruption_treatment##i.countries_new  if survey_firm == "Morning Consult"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_mc = r(table)[1,7] if inrange(counter, 1.09, 1.11)
replace mean_mc = r(table)[1,8] if inrange(counter, 2.09, 2.11)
replace mean_mc = r(table)[1,9] if inrange(counter, 3.09, 3.11)
replace mean_mc = r(table)[1,10] if inrange(counter, 4.09, 4.11)
replace mean_mc = r(table)[1,11] if inrange(counter, 5.09, 5.11)
replace mean_mc = r(table)[1,12] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table)[5,7] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table)[5,8] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table)[5,9] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table)[5,10] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table)[5,11] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table)[5,12] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table)[6,7] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table)[6,8] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table)[6,9] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table)[6,10] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table)[6,11] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table)[6,12] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway (scatter counter mean_mc , msymbol(triangle) mcolor(stc3) ) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4) ) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1)) (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), legend(order(1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) xlabel(-1.2 -1 -.8 -.6 -.4 -.2 0)  xline(0) yti("") scale(.7) saving(main_effects.gph, replace) 

* Difference in treatment effects across platforms within country *
* TESTING WHETHER TREATMENT EFFECTS ARE SIGNIFICANTLY DIFFERENT WITHIN COUNTRY ACROSS PLATFORMS WITH AND WITHOUT WEIGHTS *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if usa == 1 
replace diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor i.corruption_treatment##i.lucid if usa == 1 
replace diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if philippines == 1 
replace diff_wt = r(table)[1,8] if counter == 5
replace l = r(table)[5,8] if counter == 5
replace u = r(table)[6,8] if counter == 5
reg vote_mayor i.corruption_treatment##i.lucid if philippines == 1 
replace diff = r(table)[1,8] if counter == 6
replace l = r(table)[5,8] if counter == 6
replace u = r(table)[6,8] if counter == 6

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if nigeria == 1 
replace diff_wt = r(table)[1,8] if counter == 9
replace l = r(table)[5,8] if counter == 9
replace u = r(table)[6,8] if counter == 9
reg vote_mayor i.corruption_treatment##i.lucid if nigeria == 1 
replace diff = r(table)[1,8] if counter == 10
replace l = r(table)[5,8] if counter == 10
replace u = r(table)[6,8] if counter == 10

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if japan == 1 
replace diff_wt = r(table)[1,8] if counter == 13
replace l = r(table)[5,8] if counter == 13
replace u = r(table)[6,8] if counter == 13
reg vote_mayor i.corruption_treatment##i.lucid if japan == 1 
replace diff = r(table)[1,8] if counter == 14
replace l = r(table)[5,8] if counter == 14
replace u = r(table)[6,8] if counter == 14

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if india == 1 
replace diff_wt = r(table)[1,8] if counter == 17
replace l = r(table)[5,8] if counter == 17
replace u = r(table)[6,8] if counter == 17
reg vote_mayor i.corruption_treatment##i.lucid if india == 1 
replace diff = r(table)[1,8] if counter == 18
replace l = r(table)[5,8] if counter == 18
replace u = r(table)[6,8] if counter == 18

reg vote_mayor i.corruption_treatment##i.lucid [pw=weight_combined] if brazil == 1 
replace diff_wt = r(table)[1,8] if counter == 21
replace l = r(table)[5,8] if counter == 21
replace u = r(table)[6,8] if counter == 21
reg vote_mayor i.corruption_treatment##i.lucid if brazil == 1 
replace diff = r(table)[1,8] if counter == 22
replace l = r(table)[5,8] if counter == 22
replace u = r(table)[6,8] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.6 -.4 -.2 0 .2 .4 .6) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(treatment_diffs.gph, replace) xti("Difference in Treatment Effect (Lucid vs. MC)")

graph combine main_effects.gph treatment_diffs.gph


* Look for which Nigeria estimates are significantly lower than others *
encode country, gen(countries)
reg vote_mayor i.corruption_treatment##i.college##i.countries if survey_firm == "Morning Consult"
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#2.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#3.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#5.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#6.countries]
reg vote_mayor i.corruption_treatment##i.college##i.countries if survey_firm == "Morning Consult" [pw=wts]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#2.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#3.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#5.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#6.countries]

reg vote_mayor i.corruption_treatment##i.college##i.countries if survey_firm == "Lucid"
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#2.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#3.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#5.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#6.countries]
reg vote_mayor i.corruption_treatment##i.college##i.countries if survey_firm == "Lucid" [pw=weight_nocollege]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#2.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#3.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#5.countries]
test [1.corruption_treatment#1.college#4.countries] = [1.corruption_treatment#1.college#6.countries]

* Figure 5: Corruption treatment -- difference men and women*
use "CFKK_Lucid_MC_Combined.dta", clear

reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & usa == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) 
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare

reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & brazil == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) 
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

gen countries_new = .
replace countries_new = 1 if usa == 1
replace countries_new = 2 if philippines == 1
replace countries_new = 3 if nigeria == 1
replace countries_new = 4 if japan == 1
replace countries_new = 5 if india == 1
replace countries_new = 6 if brazil == 1

reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege]  if survey_firm == "Lucid" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 0.79, 0.81)
reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 1.79, 1.81)
reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 2.79, 2.81)
reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 3.79, 3.81)
reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 4.79, 4.81)
reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 5.78, 5.82)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 5.78, 5.82)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 5.78, 5.82)

reg vote_mayor i.corruption_treatment##i.female if survey_firm == "Lucid" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 0.89, 0.91)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 1.89, 1.91)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 2.89, 2.91)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 3.89, 3.91)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 4.89, 4.91)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 5.88, 5.92)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 5.88, 5.92)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 5.88, 5.92)

reg vote_mayor i.corruption_treatment##i.female [pw=wts]   if survey_firm == "Morning Consult" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 0.99, 1.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 0.99, 1.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 0.99, 1.01)
reg vote_mayor i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 1.99, 2.01)
reg vote_mayor i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 2.99, 3.01)
reg vote_mayor i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 3.99, 4.01)
reg vote_mayor i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 4.99, 5.01)
reg vote_mayor i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 5.99, 6.01)


reg vote_mayor i.corruption_treatment##i.female if survey_firm == "Morning Consult" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 1.09, 1.11)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 2.09, 2.11)
reg vote_mayor i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 3.09, 3.11)
reg vote_mayor i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 4.09, 4.11)
reg vote_mayor i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 5.09, 5.11)
reg vote_mayor i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 6.09, 6.11)

replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway (scatter counter mean_mc , msymbol(triangle) mcolor(stc3) ) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1)) (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2)) (rspike l_lucid u_lucid counter, lcolor(black) horizontal) (rspike l_lucidwt u_lucidwt counter, lcolor(black) horizontal)  (rspike l_mc u_mc counter, lcolor(black) horizontal) (rspike l_mcwt u_mcwt counter, lcolor(black) horizontal), legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) xti("") xti("Differential Effect of Corruption Treatment (Women vs. Men)") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25))   xline(0) yti("") scale(.7) xlabel(-.5 -.25 0 .25 .5 .75) saving(gender_treatment.gph, replace)

* TESTING WHETHER TREATMENT EFFECTS ARE SIGNIFICANTLY DIFFERENT WITHIN COUNTRY ACROSS PLATFORMS WITH AND WITHOUT WEIGHTS *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

gen corruptionxfemale = corruption_treatment*female
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if brazil==1
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
* Confirm it is same as without interaction *
reg vote_mayor i.corruption_treatment##i.female if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor i.corruption_treatment##i.female if brazil==1 & survey_firm == "Lucid"


reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if usa == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 1
replace l = r(table_vs)[5,2] if counter == 1
replace u = r(table_vs)[6,2] if counter == 1
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if usa == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 2
replace l = r(table_vs)[5,2] if counter == 2
replace u = r(table_vs)[6,2] if counter == 2

reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if philippines == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 5
replace l = r(table_vs)[5,2] if counter == 5
replace u = r(table_vs)[6,2] if counter == 5
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if philippines == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 6
replace l = r(table_vs)[5,2] if counter == 6
replace u = r(table_vs)[6,2] if counter == 6

reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if nigeria == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 9
replace l = r(table_vs)[5,2] if counter == 9
replace u = r(table_vs)[6,2] if counter == 9
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if nigeria == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 10
replace l = r(table_vs)[5,2] if counter == 10
replace u = r(table_vs)[6,2] if counter == 10

reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if japan == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 13
replace l = r(table_vs)[5,2] if counter == 13
replace u = r(table_vs)[6,2] if counter == 13
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if japan == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 14
replace l = r(table_vs)[5,2] if counter == 14
replace u = r(table_vs)[6,2] if counter == 14

reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if india == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 17
replace l = r(table_vs)[5,2] if counter == 17
replace u = r(table_vs)[6,2] if counter == 17
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if india == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 18
replace l = r(table_vs)[5,2] if counter == 18
replace u = r(table_vs)[6,2] if counter == 18

reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if brazil == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 21
replace l = r(table_vs)[5,2] if counter == 21
replace u = r(table_vs)[6,2] if counter == 21
reg vote_mayor i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if brazil == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 22
replace l = r(table_vs)[5,2] if counter == 22
replace u = r(table_vs)[6,2] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.6 -.4 -.2 0 .2 .4 .6) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(gender_treatment_diffs_by_platform.gph, replace) xti("Difference in Heterogeneous Treatment Effect (Lucid vs. MC)")

graph combine gender_treatment.gph gender_treatment_diffs_by_platform.gph

* Figure 6: College Heterogeneity *
* Testing for hetreogeneity across countries *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen mc_diff = .
gen mc_diff_wt = .
gen lucid_diff = .
gen lucid_diff_wt = .
gen l = .
gen u = .

gen corruptionxcollege = corruption_treatment*college
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil==1
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare
* Confirm it is same as without interaction *
reg vote_mayor i.corruption_treatment##i.college if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor i.corruption_treatment##i.college if brazil==1 & survey_firm == "Lucid"

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if usa == 1 & survey_firm == "Lucid" 
replace lucid_diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor i.corruption_treatment##i.college if usa == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if usa == 1 & survey_firm == "Morning Consult" 
replace mc_diff_wt = r(table)[1,8] if counter == 3
replace l = r(table)[5,8] if counter == 3
replace u = r(table)[6,8] if counter == 3
reg vote_mayor i.corruption_treatment##i.college if usa == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 4
replace l = r(table)[5,8] if counter == 4
replace u = r(table)[6,8] if counter == 4

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if philippines == 1  & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 9
replace l = r(table)[5,8] if counter == 9
replace u = r(table)[6,8] if counter == 9
reg vote_mayor i.corruption_treatment##i.college if philippines == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 10
replace l = r(table)[5,8] if counter == 10
replace u = r(table)[6,8] if counter == 10
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if philippines == 1  & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 11
replace l = r(table)[5,8] if counter == 11
replace u = r(table)[6,8] if counter == 11
reg vote_mayor i.corruption_treatment##i.college if philippines == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 12
replace l = r(table)[5,8] if counter == 12
replace u = r(table)[6,8] if counter == 12

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if nigeria == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 17
replace l = r(table)[5,8] if counter == 17
replace u = r(table)[6,8] if counter == 17
reg vote_mayor i.corruption_treatment##i.college if nigeria == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 18
replace l = r(table)[5,8] if counter == 18
replace u = r(table)[6,8] if counter == 18
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if nigeria == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 19
replace l = r(table)[5,8] if counter == 19
replace u = r(table)[6,8] if counter == 19
reg vote_mayor i.corruption_treatment##i.college if nigeria == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 20
replace l = r(table)[5,8] if counter == 20
replace u = r(table)[6,8] if counter == 20

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if japan == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 25
replace l = r(table)[5,8] if counter == 25
replace u = r(table)[6,8] if counter == 25
reg vote_mayor i.corruption_treatment##i.college if japan == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 26
replace l = r(table)[5,8] if counter == 26
replace u = r(table)[6,8] if counter == 26
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if japan == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 27
replace l = r(table)[5,8] if counter == 27
replace u = r(table)[6,8] if counter == 27
reg vote_mayor i.corruption_treatment##i.college if japan == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 28
replace l = r(table)[5,8] if counter == 28
replace u = r(table)[6,8] if counter == 28

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if india == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 33
replace l = r(table)[5,8] if counter == 33
replace u = r(table)[6,8] if counter == 33
reg vote_mayor i.corruption_treatment##i.college if india == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 34
replace l = r(table)[5,8] if counter == 34
replace u = r(table)[6,8] if counter == 34
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if india == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 35
replace l = r(table)[5,8] if counter == 35
replace u = r(table)[6,8] if counter == 35
reg vote_mayor i.corruption_treatment##i.college if india == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 36
replace l = r(table)[5,8] if counter == 36
replace u = r(table)[6,8] if counter == 36

reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if brazil == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter ==41
replace l = r(table)[5,8] if counter == 41
replace u = r(table)[6,8] if counter == 41
reg vote_mayor i.corruption_treatment##i.college if brazil == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 42
replace l = r(table)[5,8] if counter == 42
replace u = r(table)[6,8] if counter == 42
reg vote_mayor i.corruption_treatment##i.college [pw=weight_combined] if brazil == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter ==43
replace l = r(table)[5,8] if counter == 43
replace u = r(table)[6,8] if counter == 43
reg vote_mayor i.corruption_treatment##i.college if brazil == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 44
replace l = r(table)[5,8] if counter == 44
replace u = r(table)[6,8] if counter == 44

gen obs_pos = counter
replace obs_pos = . if obs_pos>44

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos mc_diff , mcolor(stc3) msymbol(triangle)) ///
    (scatter obs_pos mc_diff_wt, mcolor(stc4) msymbol(square)) ///
    (scatter obs_pos lucid_diff , mcolor(stc1) msymbol(diamond)) ///
    (scatter obs_pos lucid_diff_wt, mcolor(stc2) msymbol(Sh)), ///
	legend(order(2 "MC" 3 "MC (wt)" 4 "Lucid" 5 "Lucid (Wt)") pos(6) rows(1)) ///
	xlabel(-.8 -.6 -.4 -.2 0 .2 .4 .6) xline(0) ///
    ytitle("") ylabel(42.5 "Brazil" 34.5 "India" 26.5 "Japan" 18.5 "Nigeria" 10.5 "Philippines" 2.5 "USA") ///
    scale(.7) xti("Difference in Treatment Effect (College vs. No-College)") ///
    saving(college_treatment_diffs.gph, replace)

* Treatment Effects by Platforms *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

gen corruptionxcollege = corruption_treatment*college
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil==1
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
* Confirm it is same as without interaction *
reg vote_mayor i.corruption_treatment##i.college if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor i.corruption_treatment##i.college if brazil==1 & survey_firm == "Lucid"


reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if usa == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 1
replace l = r(table_vs)[5,2] if counter == 1
replace u = r(table_vs)[6,2] if counter == 1
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if usa == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 2
replace l = r(table_vs)[5,2] if counter == 2
replace u = r(table_vs)[6,2] if counter == 2

reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if philippines == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 5
replace l = r(table_vs)[5,2] if counter == 5
replace u = r(table_vs)[6,2] if counter == 5
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if philippines == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 6
replace l = r(table_vs)[5,2] if counter == 6
replace u = r(table_vs)[6,2] if counter == 6

reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if nigeria == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 9
replace l = r(table_vs)[5,2] if counter == 9
replace u = r(table_vs)[6,2] if counter == 9
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if nigeria == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 10
replace l = r(table_vs)[5,2] if counter == 10
replace u = r(table_vs)[6,2] if counter == 10

reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if japan == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 13
replace l = r(table_vs)[5,2] if counter == 13
replace u = r(table_vs)[6,2] if counter == 13
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if japan == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 14
replace l = r(table_vs)[5,2] if counter == 14
replace u = r(table_vs)[6,2] if counter == 14

reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if india == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 17
replace l = r(table_vs)[5,2] if counter == 17
replace u = r(table_vs)[6,2] if counter == 17
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if india == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 18
replace l = r(table_vs)[5,2] if counter == 18
replace u = r(table_vs)[6,2] if counter == 18

reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if brazil == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 21
replace l = r(table_vs)[5,2] if counter == 21
replace u = r(table_vs)[6,2] if counter == 21
reg vote_mayor i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 22
replace l = r(table_vs)[5,2] if counter == 22
replace u = r(table_vs)[6,2] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.6 -.4 -.2 0 .2 .4 .6) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(college_treatment_diffs_by_platform.gph, replace) xti("Difference in Heterogeneous Treatment Effect (Lucid vs. MC)")
	
graph combine college_treatment_diffs.gph college_treatment_diffs_by_platform.gph
	
	
* Figure 7: Brazil analysis *
use "CKKF_Brazil_threesamples.dta", clear

gen counter = _n
gen mean_wswcred = .
gen l_wswcred =.
gen u_wswcred =.
gen mean_wswless = .
gen l_wswless =.
gen u_wswless =.
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

reg vote_mayor i.corruption_treatment  [pw=weight_nocollege] if survey_firm == "Lucid"
replace mean_lucidwt = r(table)[1,2] if counter == 1
replace l_lucidwt = r(table)[5,2] if counter == 1
replace u_lucidwt = r(table)[6,2] if counter == 1
reg vote_mayor i.corruption_treatment  if survey_firm == "Lucid"
replace mean_lucid = r(table)[1,2] if counter == 2
replace l_lucid = r(table)[5,2] if counter == 2
replace u_lucid = r(table)[6,2] if counter == 2
reg vote_mayor i.corruption_treatment  [pw=wts] if survey_firm == "Morning Consult"
replace mean_mcwt = r(table)[1,2] if counter == 3
replace l_mcwt = r(table)[5,2] if counter == 3
replace u_mcwt = r(table)[6,2] if counter == 3
reg vote_mayor i.corruption_treatment   if survey_firm == "Morning Consult"
replace mean_mc = r(table)[1,2] if counter == 4
replace l_mc = r(table)[5,2] if counter == 4
replace u_mc = r(table)[6,2] if counter == 4
reg vote_mayor i.less if survey_firm == "WSW" & (pure ==1|less==1)
replace mean_wswless = r(table)[1,2] if counter == 5
replace l_wswless = r(table)[5,2] if counter == 5
replace u_wswless = r(table)[6,2] if counter == 5
reg vote_mayor i.cred if survey_firm == "WSW" & (pure ==1|cred==1)
replace mean_wswcred = r(table)[1,2] if counter == 6
replace l_wswcred = r(table)[5,2] if counter == 6
replace u_wswcred = r(table)[6,2] if counter == 6

replace counter = . if counter > 6

twoway (scatter counter mean_wswcred, msymbol(circle) mcolor(black)) (scatter counter mean_wswless, msymbol(Oh) mcolor(black)) (scatter counter mean_mc , msymbol(triangle) mcolor(stc3) ) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4) ) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1)) (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2)) (rspike l_wswcred u_wswcred counter, horizontal lcolor(black)) (rspike l_wswless u_wswless counter, horizontal lcolor(black)) (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), legend(order(1 "WSW (Federal audit)" 2 "WSW (Opp party)" 3 "MC" 4 "MC (Wt)" 5 "Lucid" 6 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") legend(pos(6) rows(1))  xlabel(-1.5 -1.25 -1 -.75 -.5 -.25 0)   xline(0) yti("") scale(.9) saving(brazil_comp.gph, replace) ylabel(1 " ", notick) yscale(range(.75 6.25))

* Formal tests of significance vs. credible WSW treatment effect estimate *
tab survey_firm, gen(firms)
ren firms1 lucid
ren firms2 mc
ren firms3 wsw

gen weight_combined = .
replace weight_combined = 1 if wsw == 1
replace weight_combined = weight_nocollege if lucid == 1
replace weight_combined = wts if mc == 1

reg vote_mayor i.corruption_treatment if survey_firm == "WSW"
reg vote_mayor i.corruption_treatment [pw=weight_combined] if survey_firm == "WSW"

svyset [pw=weight_combined]

reg vote_mayor i.corruption_treatment##i.mc if mc==1|wsw==1
svy:reg vote_mayor i.corruption_treatment##i.mc if mc==1|wsw==1
svy:reg vote_mayor i.corruption_treatment##i.lucid if lucid==1|wsw==1
reg vote_mayor i.corruption_treatment##i.lucid if lucid==1|wsw==1


* Effects by gender *
drop counter 

gen counter = _n
gen mc_diff = .
gen mc_diff_wt = .
gen lucid_diff = .
gen lucid_diff_wt = .
gen wsw_cred_diff = .
gen wsw_less_diff = .
gen l = .
gen u = .

reg vote_mayor i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" 
replace lucid_diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor i.corruption_treatment##i.female if survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2
reg vote_mayor i.corruption_treatment##i.female [pw=wts] if survey_firm == "Morning Consult" 
replace mc_diff_wt = r(table)[1,8] if counter == 3
replace l = r(table)[5,8] if counter == 3
replace u = r(table)[6,8] if counter == 3
reg vote_mayor i.corruption_treatment##i.female if survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 4
replace l = r(table)[5,8] if counter == 4
replace u = r(table)[6,8] if counter == 4
reg vote_mayor i.less##i.female if survey_firm == "WSW" & (pure ==1|less==1)
replace wsw_less_diff = r(table)[1,8] if counter == 5
replace l = r(table)[5,8] if counter == 5
replace u = r(table)[6,8] if counter == 5
reg vote_mayor i.cred##i.female if survey_firm == "WSW" & (pure ==1|cred==1)
replace wsw_cred_diff = r(table)[1,8] if counter == 6
replace l = r(table)[5,8] if counter == 6
replace u = r(table)[6,8] if counter == 6

replace counter = . if counter > 6

twoway (scatter counter wsw_cred_diff, msymbol(circle) mcolor(black)) (scatter counter wsw_less_diff, msymbol(Oh) mcolor(black)) (scatter counter mc_diff , msymbol(triangle) mcolor(stc3) ) (scatter counter mc_diff_wt, msymbol(square) mcolor(stc4) ) (scatter counter lucid_diff , msymbol(diamond) mcolor(stc1)) (scatter counter lucid_diff_wt , msymbol(Sh) mcolor(stc2)) (rspike l u counter, horizontal lcolor(black)), legend(order(1 "WSW (Federal audit)" 2 "WSW (Opp party)" 3 "MC" 4 "MC (Wt)" 5 "Lucid" 6 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") legend(pos(6) rows(1))  xline(0) yti("") scale(.9) saving(brazil_gender_comp.gph, replace) ylabel(1 " ", notick) yscale(range(.75 6.25)) xti("Difference in Treatment Effect (Women vs. Men)") xlabel(-.8 -.6 -.4 -.2 0 .2 .4 .6 .8 )

* By education *
drop counter-u

gen counter = _n
gen mc_diff = .
gen mc_diff_wt = .
gen lucid_diff = .
gen lucid_diff_wt = .
gen wsw_cred_diff = .
gen wsw_less_diff = .
gen l = .
gen u = .

gen some_tertiary = .
replace some_tertiary = 1 if education1_br>4 & survey_firm == "Morning Consult"
replace some_tertiary = 0 if education1_br<5 & survey_firm == "Morning Consult"
replace some_tertiary = 1 if education >4 & survey_firm == "Lucid"
replace some_tertiary = 0 if education<5 & survey_firm == "Lucid"
replace some_tertiary = 0 if highedu == 0 & survey_firm == "WSW"
replace some_tertiary = 1 if highedu == 1 & survey_firm == "WSW"


reg vote_mayor i.corruption_treatment##i.some_tertiary [pw=weight_nocollege] if survey_firm == "Lucid" 
replace lucid_diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor i.corruption_treatment##i.some_tertiary if survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2
reg vote_mayor i.corruption_treatment##i.some_tertiary [pw=wts] if survey_firm == "Morning Consult" 
replace mc_diff_wt = r(table)[1,8] if counter == 3
replace l = r(table)[5,8] if counter == 3
replace u = r(table)[6,8] if counter == 3
reg vote_mayor i.corruption_treatment##i.some_tertiary if survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 4
replace l = r(table)[5,8] if counter == 4
replace u = r(table)[6,8] if counter == 4
reg vote_mayor i.less##i.some_tertiary if survey_firm == "WSW" & (pure ==1|less==1)
replace wsw_less_diff = r(table)[1,8] if counter == 5
replace l = r(table)[5,8] if counter == 5
replace u = r(table)[6,8] if counter == 5
reg vote_mayor i.cred##i.some_tertiary if survey_firm == "WSW" & (pure ==1|cred==1)
replace wsw_cred_diff = r(table)[1,8] if counter == 6
replace l = r(table)[5,8] if counter == 6
replace u = r(table)[6,8] if counter == 6

replace counter = . if counter > 6

twoway (scatter counter wsw_cred_diff, msymbol(circle) mcolor(black)) (scatter counter wsw_less_diff, msymbol(Oh) mcolor(black)) (scatter counter mc_diff , msymbol(triangle) mcolor(stc3) ) (scatter counter mc_diff_wt, msymbol(square) mcolor(stc4) ) (scatter counter lucid_diff , msymbol(diamond) mcolor(stc1)) (scatter counter lucid_diff_wt , msymbol(Sh) mcolor(stc2)) (rspike l u counter, horizontal lcolor(black)), legend(order(1 "WSW (Federal audit)" 2 "WSW (Opp party)" 3 "MC" 4 "MC (Wt)" 5 "Lucid" 6 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") legend(pos(6) rows(1))  xline(0) yti("") scale(.9) saving(brazil_college_comp.gph, replace) ylabel(1 " ", notick) yscale(range(.75 6.25)) xti("Difference in Treatment Effect (Post HS vs. HS or Less)") xlabel(-.8 -.6 -.4 -.2 0 .2 .4 .6 .8) 

grc1leg2 brazil_comp.gph brazil_gender_comp.gph brazil_college_comp.gph, xsize(8.5) ysize(11) rows(3) scale(.9)

* SI ONLY: By education -- Tertiary for WSW; College for MC and Lucid *
drop counter-u

gen counter = _n
gen mc_diff = .
gen mc_diff_wt = .
gen lucid_diff = .
gen lucid_diff_wt = .
gen wsw_cred_diff = .
gen wsw_less_diff = .
gen l = .
gen u = .

reg vote_mayor i.corruption_treatment##i.college [pw=weight_nocollege] if survey_firm == "Lucid" 
replace lucid_diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor i.corruption_treatment##i.college if survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2
reg vote_mayor i.corruption_treatment##i.college [pw=wts] if survey_firm == "Morning Consult" 
replace mc_diff_wt = r(table)[1,8] if counter == 3
replace l = r(table)[5,8] if counter == 3
replace u = r(table)[6,8] if counter == 3
reg vote_mayor i.corruption_treatment##i.college if survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 4
replace l = r(table)[5,8] if counter == 4
replace u = r(table)[6,8] if counter == 4
reg vote_mayor i.less##i.some_tertiary if survey_firm == "WSW" & (pure ==1|less==1)
replace wsw_less_diff = r(table)[1,8] if counter == 5
replace l = r(table)[5,8] if counter == 5
replace u = r(table)[6,8] if counter == 5
reg vote_mayor i.cred##i.some_tertiary if survey_firm == "WSW" & (pure ==1|cred==1)
replace wsw_cred_diff = r(table)[1,8] if counter == 6
replace l = r(table)[5,8] if counter == 6
replace u = r(table)[6,8] if counter == 6

replace counter = . if counter > 6

twoway (scatter counter wsw_cred_diff, msymbol(circle) mcolor(black)) (scatter counter wsw_less_diff, msymbol(Oh) mcolor(black)) (scatter counter mc_diff , msymbol(triangle) mcolor(stc3) ) (scatter counter mc_diff_wt, msymbol(square) mcolor(stc4) ) (scatter counter lucid_diff , msymbol(diamond) mcolor(stc1)) (scatter counter lucid_diff_wt , msymbol(Sh) mcolor(stc2)) (rspike l u counter, horizontal lcolor(black)), legend(order(1 "WSW (Federal audit)" 2 "WSW (Opp party)" 3 "MC" 4 "MC (Wt)" 5 "Lucid" 6 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") legend(pos(6) rows(1))  xline(0) yti("") scale(.9) saving(brazil_education_comp.gph, replace) ylabel(1 " ", notick) yscale(range(.75 6.25)) xti("Difference in Treatment Effect (High  vs. Low Education)") xlabel(-.6 -.4 -.2 0 .2 .4 .6) 

* Figure 8, top panel: Trust in GOVT Figure *
use "CFKK_Lucid_MC_Combined.dta", clear
gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .
* Reminder: 1 "Philippines" 2 "Nigeria" 3 "India" 4 "Brazil" 5 "Japan" 6 "USA", replace

reg trust_govt usa philippines nigeria japan india brazil [pw=weight_nocollege]  if survey_firm == "Lucid" , nocons
replace mean_lucidwt = r(table)[1,1] if inrange(counter, 0.79, 0.81)
replace mean_lucidwt = r(table)[1,2] if inrange(counter, 1.79, 1.81)
replace mean_lucidwt = r(table)[1,3] if inrange(counter, 2.79, 2.81)
replace mean_lucidwt = r(table)[1,4] if inrange(counter, 3.79, 3.81)
replace mean_lucidwt = r(table)[1,5] if inrange(counter, 4.79, 4.81)
replace mean_lucidwt = r(table)[1,6] if inrange(counter, 5.79, 5.81)
replace l_lucidwt = r(table)[5,1] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table)[5,2] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table)[5,3] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table)[5,4] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table)[5,5] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table)[5,6] if inrange(counter, 5.79, 5.81)
replace u_lucidwt = r(table)[6,1] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table)[6,2] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table)[6,3] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table)[6,4] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table)[6,5] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table)[6,6] if inrange(counter, 5.79, 5.81)

reg trust_govt usa philippines nigeria japan india brazil  if survey_firm == "Lucid", nocons
replace mean_lucid = r(table)[1,1] if inrange(counter, 0.89, 0.91)
replace mean_lucid = r(table)[1,2] if inrange(counter, 1.89, 1.91)
replace mean_lucid = r(table)[1,3] if inrange(counter, 2.89, 2.91)
replace mean_lucid = r(table)[1,4] if inrange(counter, 3.89, 3.91)
replace mean_lucid = r(table)[1,5] if inrange(counter, 4.89, 4.91)
replace mean_lucid = r(table)[1,6] if inrange(counter, 5.89, 5.91)
replace l_lucid = r(table)[5,1] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table)[5,2] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table)[5,3] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table)[5,4] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table)[5,5] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table)[5,6] if inrange(counter, 5.89, 5.91)
replace u_lucid = r(table)[6,1] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table)[6,2] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table)[6,3] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table)[6,4] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table)[6,5] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table)[6,6] if inrange(counter, 5.89, 5.91)

reg trust_govt usa philippines nigeria japan india brazil [pw=wts] if survey_firm == "Morning Consult", nocons
replace mean_mcwt = r(table)[1,1] if inrange(counter, .99, 1.01)
replace mean_mcwt = r(table)[1,2] if inrange(counter, 1.99, 2.01)
replace mean_mcwt = r(table)[1,3] if inrange(counter, 2.99, 3.01)
replace mean_mcwt = r(table)[1,4] if inrange(counter, 3.99, 4.01)
replace mean_mcwt = r(table)[1,5] if inrange(counter, 4.99, 5.01)
replace mean_mcwt = r(table)[1,6] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table)[5,1] if inrange(counter, .99, 1.01)
replace l_mcwt = r(table)[5,2] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table)[5,3] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table)[5,4] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table)[5,5] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table)[5,6] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table)[6,1] if inrange(counter, .99, 1.01)
replace u_mcwt = r(table)[6,2] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table)[6,3] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table)[6,4] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table)[6,5] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table)[6,6] if inrange(counter, 5.99, 6.01)

reg trust_govt usa philippines nigeria japan india brazil  if survey_firm == "Morning Consult", nocons
replace mean_mc = r(table)[1,1] if inrange(counter, 1.09, 1.11)
replace mean_mc = r(table)[1,2] if inrange(counter, 2.09, 2.11)
replace mean_mc = r(table)[1,3] if inrange(counter, 3.09, 3.11)
replace mean_mc = r(table)[1,4] if inrange(counter, 4.09, 4.11)
replace mean_mc = r(table)[1,5] if inrange(counter, 5.09, 5.11)
replace mean_mc = r(table)[1,6] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table)[5,1] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table)[5,2] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table)[5,3] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table)[5,4] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table)[5,5] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table)[5,6] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table)[6,1] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table)[6,2] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table)[6,3] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table)[6,4] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table)[6,5] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table)[6,6] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway  (scatter counter mean_mc , msymbol(triangle) mcolor(stc3)) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1))  (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), xlabel(0 1 2 3 4 5 6 7 8 9 10) xti("Average Reported Trust in Government") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) yti("") ti("") scale(.7)  legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) saving(trust_govt.gph, replace)

* Figure 8, middle panel: Social Trust *
use "CFKK_Lucid_MC_Combined.dta", clear

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .
* Reminder: 1 "Philippines" 2 "Nigeria" 3 "India" 4 "Brazil" 5 "Japan" 6 "USA", replace

reg social_trust usa philippines nigeria japan india brazil if survey_firm == "Lucid", nocons
replace mean_lucid = r(table)[1,1] if inrange(counter, 0.79, 0.81)
replace mean_lucid = r(table)[1,2] if inrange(counter, 1.79, 1.81)
replace mean_lucid = r(table)[1,3] if inrange(counter, 2.79, 2.81)
replace mean_lucid = r(table)[1,4] if inrange(counter, 3.79, 3.81)
replace mean_lucid = r(table)[1,5] if inrange(counter, 4.79, 4.81)
replace mean_lucid = r(table)[1,6] if inrange(counter, 5.79, 5.81)
replace l_lucid = r(table)[5,1] if inrange(counter, 0.79, 0.81)
replace l_lucid = r(table)[5,2] if inrange(counter, 1.79, 1.81)
replace l_lucid = r(table)[5,3] if inrange(counter, 2.79, 2.81)
replace l_lucid = r(table)[5,4] if inrange(counter, 3.79, 3.81)
replace l_lucid = r(table)[5,5] if inrange(counter, 4.79, 4.81)
replace l_lucid = r(table)[5,6] if inrange(counter, 5.79, 5.81)
replace u_lucid = r(table)[6,1] if inrange(counter, 0.79, 0.81)
replace u_lucid = r(table)[6,2] if inrange(counter, 1.79, 1.81)
replace u_lucid = r(table)[6,3] if inrange(counter, 2.79, 2.81)
replace u_lucid = r(table)[6,4] if inrange(counter, 3.79, 3.81)
replace u_lucid = r(table)[6,5] if inrange(counter, 4.79, 4.81)
replace u_lucid = r(table)[6,6] if inrange(counter, 5.79, 5.81)

reg social_trust usa philippines nigeria japan india brazil [pw=weight_nocollege] if survey_firm == "Lucid", nocons
replace mean_lucidwt = r(table)[1,1] if inrange(counter, 0.89, 0.91)
replace mean_lucidwt = r(table)[1,2] if inrange(counter, 1.89, 1.91)
replace mean_lucidwt = r(table)[1,3] if inrange(counter, 2.89, 2.91)
replace mean_lucidwt = r(table)[1,4] if inrange(counter, 3.89, 3.91)
replace mean_lucidwt = r(table)[1,5] if inrange(counter, 4.89, 4.91)
replace mean_lucidwt = r(table)[1,6] if inrange(counter, 5.89, 5.91)
replace l_lucidwt = r(table)[5,1] if inrange(counter, 0.89, 0.91)
replace l_lucidwt = r(table)[5,2] if inrange(counter, 1.89, 1.91)
replace l_lucidwt = r(table)[5,3] if inrange(counter, 2.89, 2.91)
replace l_lucidwt = r(table)[5,4] if inrange(counter, 3.89, 3.91)
replace l_lucidwt = r(table)[5,5] if inrange(counter, 4.89, 4.91)
replace l_lucidwt = r(table)[5,6] if inrange(counter, 5.89, 5.91)
replace u_lucidwt = r(table)[6,1] if inrange(counter, 0.89, 0.91)
replace u_lucidwt = r(table)[6,2] if inrange(counter, 1.89, 1.91)
replace u_lucidwt = r(table)[6,3] if inrange(counter, 2.89, 2.91)
replace u_lucidwt = r(table)[6,4] if inrange(counter, 3.89, 3.91)
replace u_lucidwt = r(table)[6,5] if inrange(counter, 4.89, 4.91)
replace u_lucidwt = r(table)[6,6] if inrange(counter, 5.89, 5.91)

reg social_trust usa philippines nigeria japan india brazil if survey_firm == "Morning Consult", nocons
replace mean_mc = r(table)[1,1] if inrange(counter, .99, 1.01)
replace mean_mc = r(table)[1,2] if inrange(counter, 1.99, 2.01)
replace mean_mc = r(table)[1,3] if inrange(counter, 2.99, 3.01)
replace mean_mc = r(table)[1,4] if inrange(counter, 3.99, 4.01)
replace mean_mc = r(table)[1,5] if inrange(counter, 4.99, 5.01)
replace mean_mc = r(table)[1,6] if inrange(counter, 5.99, 6.01)
replace l_mc = r(table)[5,1] if inrange(counter, .99, 1.01)
replace l_mc = r(table)[5,2] if inrange(counter, 1.99, 2.01)
replace l_mc = r(table)[5,3] if inrange(counter, 2.99, 3.01)
replace l_mc = r(table)[5,4] if inrange(counter, 3.99, 4.01)
replace l_mc = r(table)[5,5] if inrange(counter, 4.99, 5.01)
replace l_mc = r(table)[5,6] if inrange(counter, 5.99, 6.01)
replace u_mc = r(table)[6,1] if inrange(counter, .99, 1.01)
replace u_mc = r(table)[6,2] if inrange(counter, 1.99, 2.01)
replace u_mc = r(table)[6,3] if inrange(counter, 2.99, 3.01)
replace u_mc = r(table)[6,4] if inrange(counter, 3.99, 4.01)
replace u_mc = r(table)[6,5] if inrange(counter, 4.99, 5.01)
replace u_mc = r(table)[6,6] if inrange(counter, 5.99, 6.01)

reg social_trust usa philippines nigeria japan india brazil if survey_firm == "Morning Consult" [pw=wts], nocons
replace mean_mcwt = r(table)[1,1] if inrange(counter, 1.09, 1.11)
replace mean_mcwt = r(table)[1,2] if inrange(counter, 2.09, 2.11)
replace mean_mcwt = r(table)[1,3] if inrange(counter, 3.09, 3.11)
replace mean_mcwt = r(table)[1,4] if inrange(counter, 4.09, 4.11)
replace mean_mcwt = r(table)[1,5] if inrange(counter, 5.09, 5.11)
replace mean_mcwt = r(table)[1,6] if inrange(counter, 6.09, 6.11)
replace l_mcwt = r(table)[5,1] if inrange(counter, 1.09, 1.11)
replace l_mcwt = r(table)[5,2] if inrange(counter, 2.09, 2.11)
replace l_mcwt = r(table)[5,3] if inrange(counter, 3.09, 3.11)
replace l_mcwt = r(table)[5,4] if inrange(counter, 4.09, 4.11)
replace l_mcwt = r(table)[5,5] if inrange(counter, 5.09, 5.11)
replace l_mcwt = r(table)[5,6] if inrange(counter, 6.09, 6.11)
replace u_mcwt = r(table)[6,1] if inrange(counter, 1.09, 1.11)
replace u_mcwt = r(table)[6,2] if inrange(counter, 2.09, 2.11)
replace u_mcwt = r(table)[6,3] if inrange(counter, 3.09, 3.11)
replace u_mcwt = r(table)[6,4] if inrange(counter, 4.09, 4.11)
replace u_mcwt = r(table)[6,5] if inrange(counter, 5.09, 5.11)
replace u_mcwt = r(table)[6,6] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway  (scatter counter mean_mc , msymbol(triangle) mcolor(stc3)) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1))  (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), xlabel(0 1 2 3 4 5 6 7 8 9 10) xti("Average Reported Social Trust") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) yti("") ti("") scale(.7)  legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) saving(social_trust.gph, replace)

* Figure 8, bottom panel: Trust in GOVT Figure *
use "CFKK_Lucid_MC_Combined.dta", clear

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .
* Reminder: 1 "Philippines" 2 "Nigeria" 3 "India" 4 "Brazil" 5 "Japan" 6 "USA", replace

reg confidence_finance usa philippines nigeria japan india brazil if survey_firm == "Lucid", nocons
replace mean_lucid = r(table)[1,1] if inrange(counter, 0.79, 0.81)
replace mean_lucid = r(table)[1,2] if inrange(counter, 1.79, 1.81)
replace mean_lucid = r(table)[1,3] if inrange(counter, 2.79, 2.81)
replace mean_lucid = r(table)[1,4] if inrange(counter, 3.79, 3.81)
replace mean_lucid = r(table)[1,5] if inrange(counter, 4.79, 4.81)
replace mean_lucid = r(table)[1,6] if inrange(counter, 5.79, 5.81)
replace l_lucid = r(table)[5,1] if inrange(counter, 0.79, 0.81)
replace l_lucid = r(table)[5,2] if inrange(counter, 1.79, 1.81)
replace l_lucid = r(table)[5,3] if inrange(counter, 2.79, 2.81)
replace l_lucid = r(table)[5,4] if inrange(counter, 3.79, 3.81)
replace l_lucid = r(table)[5,5] if inrange(counter, 4.79, 4.81)
replace l_lucid = r(table)[5,6] if inrange(counter, 5.79, 5.81)
replace u_lucid = r(table)[6,1] if inrange(counter, 0.79, 0.81)
replace u_lucid = r(table)[6,2] if inrange(counter, 1.79, 1.81)
replace u_lucid = r(table)[6,3] if inrange(counter, 2.79, 2.81)
replace u_lucid = r(table)[6,4] if inrange(counter, 3.79, 3.81)
replace u_lucid = r(table)[6,5] if inrange(counter, 4.79, 4.81)
replace u_lucid = r(table)[6,6] if inrange(counter, 5.79, 5.81)

reg confidence_finance usa philippines nigeria japan india brazil [pw=weight_nocollege] if survey_firm == "Lucid", nocons
replace mean_lucidwt = r(table)[1,1] if inrange(counter, 0.89, 0.91)
replace mean_lucidwt = r(table)[1,2] if inrange(counter, 1.89, 1.91)
replace mean_lucidwt = r(table)[1,3] if inrange(counter, 2.89, 2.91)
replace mean_lucidwt = r(table)[1,4] if inrange(counter, 3.89, 3.91)
replace mean_lucidwt = r(table)[1,5] if inrange(counter, 4.89, 4.91)
replace mean_lucidwt = r(table)[1,6] if inrange(counter, 5.89, 5.91)
replace l_lucidwt = r(table)[5,1] if inrange(counter, 0.89, 0.91)
replace l_lucidwt = r(table)[5,2] if inrange(counter, 1.89, 1.91)
replace l_lucidwt = r(table)[5,3] if inrange(counter, 2.89, 2.91)
replace l_lucidwt = r(table)[5,4] if inrange(counter, 3.89, 3.91)
replace l_lucidwt = r(table)[5,5] if inrange(counter, 4.89, 4.91)
replace l_lucidwt = r(table)[5,6] if inrange(counter, 5.89, 5.91)
replace u_lucidwt = r(table)[6,1] if inrange(counter, 0.89, 0.91)
replace u_lucidwt = r(table)[6,2] if inrange(counter, 1.89, 1.91)
replace u_lucidwt = r(table)[6,3] if inrange(counter, 2.89, 2.91)
replace u_lucidwt = r(table)[6,4] if inrange(counter, 3.89, 3.91)
replace u_lucidwt = r(table)[6,5] if inrange(counter, 4.89, 4.91)
replace u_lucidwt = r(table)[6,6] if inrange(counter, 5.89, 5.91)

reg confidence_finance usa philippines nigeria japan india brazil if survey_firm == "Morning Consult", nocons
replace mean_mc = r(table)[1,1] if inrange(counter, .99, 1.01)
replace mean_mc = r(table)[1,2] if inrange(counter, 1.99, 2.01)
replace mean_mc = r(table)[1,3] if inrange(counter, 2.99, 3.01)
replace mean_mc = r(table)[1,4] if inrange(counter, 3.99, 4.01)
replace mean_mc = r(table)[1,5] if inrange(counter, 4.99, 5.01)
replace mean_mc = r(table)[1,6] if inrange(counter, 5.99, 6.01)
replace l_mc = r(table)[5,1] if inrange(counter, .99, 1.01)
replace l_mc = r(table)[5,2] if inrange(counter, 1.99, 2.01)
replace l_mc = r(table)[5,3] if inrange(counter, 2.99, 3.01)
replace l_mc = r(table)[5,4] if inrange(counter, 3.99, 4.01)
replace l_mc = r(table)[5,5] if inrange(counter, 4.99, 5.01)
replace l_mc = r(table)[5,6] if inrange(counter, 5.99, 6.01)
replace u_mc = r(table)[6,1] if inrange(counter, .99, 1.01)
replace u_mc = r(table)[6,2] if inrange(counter, 1.99, 2.01)
replace u_mc = r(table)[6,3] if inrange(counter, 2.99, 3.01)
replace u_mc = r(table)[6,4] if inrange(counter, 3.99, 4.01)
replace u_mc = r(table)[6,5] if inrange(counter, 4.99, 5.01)
replace u_mc = r(table)[6,6] if inrange(counter, 5.99, 6.01)

reg confidence_finance usa philippines nigeria japan india brazil if survey_firm == "Morning Consult" [pw=wts], nocons
replace mean_mcwt = r(table)[1,1] if inrange(counter, 1.09, 1.11)
replace mean_mcwt = r(table)[1,2] if inrange(counter, 2.09, 2.11)
replace mean_mcwt = r(table)[1,3] if inrange(counter, 3.09, 3.11)
replace mean_mcwt = r(table)[1,4] if inrange(counter, 4.09, 4.11)
replace mean_mcwt = r(table)[1,5] if inrange(counter, 5.09, 5.11)
replace mean_mcwt = r(table)[1,6] if inrange(counter, 6.09, 6.11)
replace l_mcwt = r(table)[5,1] if inrange(counter, 1.09, 1.11)
replace l_mcwt = r(table)[5,2] if inrange(counter, 2.09, 2.11)
replace l_mcwt = r(table)[5,3] if inrange(counter, 3.09, 3.11)
replace l_mcwt = r(table)[5,4] if inrange(counter, 4.09, 4.11)
replace l_mcwt = r(table)[5,5] if inrange(counter, 5.09, 5.11)
replace l_mcwt = r(table)[5,6] if inrange(counter, 6.09, 6.11)
replace u_mcwt = r(table)[6,1] if inrange(counter, 1.09, 1.11)
replace u_mcwt = r(table)[6,2] if inrange(counter, 2.09, 2.11)
replace u_mcwt = r(table)[6,3] if inrange(counter, 3.09, 3.11)
replace u_mcwt = r(table)[6,4] if inrange(counter, 4.09, 4.11)
replace u_mcwt = r(table)[6,5] if inrange(counter, 5.09, 5.11)
replace u_mcwt = r(table)[6,6] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway  (scatter counter mean_mc , msymbol(triangle) mcolor(stc3)) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1))  (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), xlabel(1 2 3 4) xti("Average Reported Confidence in Financial Institutions") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) yti("") ti("") scale(.7)  legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) saving(confidence.gph, replace)

grc1leg2 trust_govt.gph social_trust.gph confidence.gph, xsize(8.5) ysize(11) rows(3) cols(1)

* CODE TO REPRODUCE STATISTICAL ANALYSES REPORTED IN SUPPLEMENTARY MATERIALS *

* Sensitivity Analyses *

* Randomization checks referenced in Section E of Supplementary Material *
ttest age if survey_firm == "Lucid" & brazil==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & brazil==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & brazil==1, by(corruption_treatment)
ttest age if survey_firm == "Lucid" & india==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & india==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & india==1, by(corruption_treatment)
ttest age if survey_firm == "Lucid" & japan==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & japan==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & japan==1, by(corruption_treatment)
ttest age if survey_firm == "Lucid" & nigeria==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & nigeria==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & nigeria==1, by(corruption_treatment)
ttest age if survey_firm == "Lucid" & philippines==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & philippines==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & philippines==1, by(corruption_treatment)
ttest age if survey_firm == "Lucid" & usa==1, by(corruption_treatment)
ttest female if survey_firm == "Lucid" & usa==1, by(corruption_treatment)
ttest college if survey_firm == "Lucid" & usa==1, by(corruption_treatment)
* None are significantly different, p < .05; one is p < .10 *
ttest age if survey_firm == "Morning Consult" & brazil==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & brazil==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & brazil==1, by(corruption_treatment)
ttest age if survey_firm == "Morning Consult" & india==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & india==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & india==1, by(corruption_treatment)
ttest age if survey_firm == "Morning Consult" & japan==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & japan==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & japan==1, by(corruption_treatment)
ttest age if survey_firm == "Morning Consult" & nigeria==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & nigeria==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & nigeria==1, by(corruption_treatment)
ttest age if survey_firm == "Morning Consult" & philippines==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & philippines==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & philippines==1, by(corruption_treatment)
ttest age if survey_firm == "Morning Consult" & usa==1, by(corruption_treatment)
ttest female if survey_firm == "Morning Consult" & usa==1, by(corruption_treatment)
ttest college if survey_firm == "Morning Consult" & usa==1, by(corruption_treatment)
* None are significantly different, p < .05; 3 are p < .10 *

* Successful randomization across treatment and control experimental groups will produce unbiased estimates of sample average treatment effects (SATE).  Randomization checks suggest that randomization was successful across our samples.  For example, t-tests of average age, percent women, and percent with college degrees across all six countries and the two survey platforms did not reveal any differences across treatment and control groups that were statistically significant, p < .05, two-tailed test.  However, it is always possible that there is an imbalance across experimental conditions on some unobserved dimension, and if this factor also moderates the effect of the treatment, then our SATE estimates will be biased.  A sensitivity analysis allows us to estimate how strong an omitted moderator (that was also correlated with assignment to the treatment or control group) would have to be to overwhelm our estimated SATE.  To construct bias contour plots that help visualize this sensitivity to an omitted moderator relative to observed benchmarks for gender and college educational attainment we estimated a series of regressions in which assignment to the corruption treatment group is the independent variable of interest, and indicator variables for women respondents and respondents with at least a four-year college degree are included as control variables.  The code for these regressions is below.  In all countries except the United States, Morning Consult's gender question, which we mirrored on the Lucid surveys, asked "What is your gender?"  The response choices were male or female.  In the United States, the question wording was the same, but a third response choice of "Not listed" was given.  Two respondents (out of 2,108) in the Morning Consult survey chose the "Not listed" option, as did five respondents (out of 2,000) in the Lucid survey.  The "woman" variable used in the regressions below and for the moderation analyses reported in the text treats these respondents as missing.  

* Code for Regressions with and without our moderators *
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & brazil == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) replace
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & brazil == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & india == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & india == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & japan == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & japan == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & nigeria == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & nigeria == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & philippines == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & philippines == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Morning Consult" & usa == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & usa == 1
outreg2 using sensmc.doc, label  dec(2) noaster stats(coef pval) append

reg vote_mayor corruption_treatment if survey_firm == "Lucid" & brazil == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) replace
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & brazil == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Lucid" & india == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & india == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Lucid" & japan == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & japan == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Lucid" & nigeria == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & nigeria == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Lucid" & philippines == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & philippines == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment if survey_firm == "Lucid" & usa == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append
reg vote_mayor corruption_treatment female college if survey_firm == "Lucid" & usa == 1
outreg2 using sensl.doc, label  dec(2) noaster stats(coef pval) append

* Code for RVq	RValpha values presented in Supplementary Material Table S3
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & brazil == 1, treat(corruption_treatment)  
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & india == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & japan == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & nigeria == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & philippines == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & usa == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & brazil == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & india == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & japan == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & nigeria == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & philippines == 1, treat(corruption_treatment) 
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Lucid" & usa == 1, treat(corruption_treatment) 

* Finally, the code below produces bias contour plots for the MC data.  While these sensitivity analyses do not tell us whether such a confounder exists, they do tell us the scale of confounding that would be needed to overwhelm our sample estimated treatment effect. 
* Brazil *
use "CFKK_Lucid_MC_Combined.dta", clear
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & brazil == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1) 
graph save brazil_cplot.gph, replace
* India *
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & india == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1) 
graph save india_cplot.gph, replace
* Japan *
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & japan == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1)
graph save japan_cplot.gph, replace
* Nigeria *
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & nigeria == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1)
graph save nigeria_cplot.gph, replace
* Philippines *
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & philippines == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1)
graph save philippines_cplot.gph, replace
* USA *
sensemakr vote_mayor corruption_treatment female college if survey_firm == "Morning Consult" & usa == 1, treat(corruption_treatment) contourplot benchmark(college) kd(1)
graph save usa_cplot.gph, replace
graph combine brazil_cplot.gph india_cplot.gph japan_cplot.gph nigeria_cplot.gph philippines_cplot.gph usa_cplot.gph, xsize(11) ysize(8.5) rows(2) cols(3)

* Alternate Operationalizations of Dependent Variable (Binary) *

* Figure S1: Experimental Main Effects *
* Mayoral Corruption Treatment Effect *
use "CFKK_Lucid_MC_Combined.dta", clear

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

gen countries_new = .
replace countries_new = 1 if usa == 1
replace countries_new = 2 if philippines == 1
replace countries_new = 3 if nigeria == 1
replace countries_new = 4 if japan == 1
replace countries_new = 5 if india == 1
replace countries_new = 6 if brazil == 1

reg vote_mayor_bin i.corruption_treatment##i.countries_new  [pw=weight_nocollege] if survey_firm == "Lucid"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_lucidwt = r(table)[1,7] if inrange(counter, 0.79, 0.81)
replace mean_lucidwt = r(table)[1,8] if inrange(counter, 1.79, 1.81)
replace mean_lucidwt = r(table)[1,9] if inrange(counter, 2.79, 2.81)
replace mean_lucidwt = r(table)[1,10] if inrange(counter, 3.79, 3.81)
replace mean_lucidwt = r(table)[1,11] if inrange(counter, 4.79, 4.81)
replace mean_lucidwt = r(table)[1,12] if inrange(counter, 5.79, 5.81)
replace l_lucidwt = r(table)[5,7] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table)[5,8] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table)[5,9] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table)[5,10] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table)[5,11] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table)[5,12] if inrange(counter, 5.79, 5.81)
replace u_lucidwt = r(table)[6,7] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table)[6,8] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table)[6,9] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table)[6,10] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table)[6,11] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table)[6,12] if inrange(counter, 5.79, 5.81)

reg vote_mayor_bin i.corruption_treatment##i.countries_new  if survey_firm == "Lucid"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_lucid = r(table)[1,7] if inrange(counter, 0.89, 0.91)
replace mean_lucid = r(table)[1,8] if inrange(counter, 1.89, 1.91)
replace mean_lucid = r(table)[1,9] if inrange(counter, 2.89, 2.91)
replace mean_lucid = r(table)[1,10] if inrange(counter, 3.89, 3.91)
replace mean_lucid = r(table)[1,11] if inrange(counter, 4.89, 4.91)
replace mean_lucid = r(table)[1,12] if inrange(counter, 5.89, 5.91)
replace l_lucid = r(table)[5,7] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table)[5,8] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table)[5,9] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table)[5,10] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table)[5,11] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table)[5,12] if inrange(counter, 5.89, 5.91)
replace u_lucid = r(table)[6,7] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table)[6,8] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table)[6,9] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table)[6,10] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table)[6,11] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table)[6,12] if inrange(counter, 5.89, 5.91)

reg vote_mayor_bin i.corruption_treatment##i.countries_new  [pw=wts]if survey_firm == "Morning Consult"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_mcwt = r(table)[1,7] if inrange(counter, .99, 1.01)
replace mean_mcwt = r(table)[1,8] if inrange(counter, 1.99, 2.01)
replace mean_mcwt = r(table)[1,9] if inrange(counter, 2.99, 3.01)
replace mean_mcwt = r(table)[1,10] if inrange(counter, 3.99, 4.01)
replace mean_mcwt = r(table)[1,11] if inrange(counter, 4.99, 5.01)
replace mean_mcwt = r(table)[1,12] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table)[5,7] if inrange(counter, .99, 1.01)
replace l_mcwt = r(table)[5,8] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table)[5,9] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table)[5,10] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table)[5,11] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table)[5,12] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table)[6,7] if inrange(counter, .99, 1.01)
replace u_mcwt = r(table)[6,8] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table)[6,9] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table)[6,10] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table)[6,11] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table)[6,12] if inrange(counter, 5.99, 6.01)

reg vote_mayor_bin i.corruption_treatment##i.countries_new  if survey_firm == "Morning Consult"
margins, dydx(corruption_treatment) at(countries_new=(1(1)6))
replace mean_mc = r(table)[1,7] if inrange(counter, 1.09, 1.11)
replace mean_mc = r(table)[1,8] if inrange(counter, 2.09, 2.11)
replace mean_mc = r(table)[1,9] if inrange(counter, 3.09, 3.11)
replace mean_mc = r(table)[1,10] if inrange(counter, 4.09, 4.11)
replace mean_mc = r(table)[1,11] if inrange(counter, 5.09, 5.11)
replace mean_mc = r(table)[1,12] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table)[5,7] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table)[5,8] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table)[5,9] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table)[5,10] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table)[5,11] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table)[5,12] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table)[6,7] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table)[6,8] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table)[6,9] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table)[6,10] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table)[6,11] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table)[6,12] if inrange(counter, 6.09, 6.11)
replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway (scatter counter mean_mc , msymbol(triangle) mcolor(stc3) ) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4) ) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1)) (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2))  (rspike l_lucid u_lucid counter, horizontal lcolor(black)) (rspike l_lucidwt u_lucidwt counter, horizontal lcolor(black)) (rspike l_mc u_mc counter,horizontal lcolor(black)) (rspike l_mcwt u_mcwt counter,horizontal lcolor(black)), legend(order(1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) xti("") xti("Effect of Corruption Treatment") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25)) xlabel(-.6 -.5 -.4 -.3 -.2 -.1 0)  xline(0) yti("") scale(.7) saving(main_effectsbin.gph, replace) 

* Difference in treatment effects across platforms within country *
* TESTING WHETHER TREATMENT EFFECTS ARE SIGNIFICANTLY DIFFERENT WITHIN COUNTRY ACROSS PLATFORMS WITH AND WITHOUT WEIGHTS *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if usa == 1 
replace diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor_bin i.corruption_treatment##i.lucid if usa == 1 
replace diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if philippines == 1 
replace diff_wt = r(table)[1,8] if counter == 5
replace l = r(table)[5,8] if counter == 5
replace u = r(table)[6,8] if counter == 5
reg vote_mayor_bin i.corruption_treatment##i.lucid if philippines == 1 
replace diff = r(table)[1,8] if counter == 6
replace l = r(table)[5,8] if counter == 6
replace u = r(table)[6,8] if counter == 6

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if nigeria == 1 
replace diff_wt = r(table)[1,8] if counter == 9
replace l = r(table)[5,8] if counter == 9
replace u = r(table)[6,8] if counter == 9
reg vote_mayor_bin i.corruption_treatment##i.lucid if nigeria == 1 
replace diff = r(table)[1,8] if counter == 10
replace l = r(table)[5,8] if counter == 10
replace u = r(table)[6,8] if counter == 10

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if japan == 1 
replace diff_wt = r(table)[1,8] if counter == 13
replace l = r(table)[5,8] if counter == 13
replace u = r(table)[6,8] if counter == 13
reg vote_mayor_bin i.corruption_treatment##i.lucid if japan == 1 
replace diff = r(table)[1,8] if counter == 14
replace l = r(table)[5,8] if counter == 14
replace u = r(table)[6,8] if counter == 14

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if india == 1 
replace diff_wt = r(table)[1,8] if counter == 17
replace l = r(table)[5,8] if counter == 17
replace u = r(table)[6,8] if counter == 17
reg vote_mayor_bin i.corruption_treatment##i.lucid if india == 1 
replace diff = r(table)[1,8] if counter == 18
replace l = r(table)[5,8] if counter == 18
replace u = r(table)[6,8] if counter == 18

reg vote_mayor_bin i.corruption_treatment##i.lucid [pw=weight_combined] if brazil == 1 
replace diff_wt = r(table)[1,8] if counter == 21
replace l = r(table)[5,8] if counter == 21
replace u = r(table)[6,8] if counter == 21
reg vote_mayor_bin i.corruption_treatment##i.lucid if brazil == 1 
replace diff = r(table)[1,8] if counter == 22
replace l = r(table)[5,8] if counter == 22
replace u = r(table)[6,8] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.4 -.3 -.2 -.1 0 .1 .2 .3 .4) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(treatment_diffsbin.gph, replace) xti("Difference in Treatment Effect (Lucid vs. MC)")
	
graph combine main_effectsbin.gph treatment_diffsbin.gph

* Figure S2: Corruption treatment -- difference men and women*
use "CFKK_Lucid_MC_Combined.dta", clear

reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & usa == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) 
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare

reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & brazil == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) 
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare

gen counter = _n/10
gen mean_lucid = .
gen mean_lucidwt =.
gen mean_mc = .
gen mean_mcwt = .
gen l_lucid = .
gen u_lucid = .
gen l_lucidwt = .
gen u_lucidwt = .
gen l_mc = .
gen u_mc = .
gen l_mcwt = .
gen u_mcwt = .

gen countries_new = .
replace countries_new = 1 if usa == 1
replace countries_new = 2 if philippines == 1
replace countries_new = 3 if nigeria == 1
replace countries_new = 4 if japan == 1
replace countries_new = 5 if india == 1
replace countries_new = 6 if brazil == 1

reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege]  if survey_firm == "Lucid" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 0.79, 0.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 0.79, 0.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 0.79, 0.81)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 1.79, 1.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 1.79, 1.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 1.79, 1.81)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 2.79, 2.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 2.79, 2.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 2.79, 2.81)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 3.79, 3.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 3.79, 3.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 3.79, 3.81)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 4.79, 4.81)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 4.79, 4.81)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 4.79, 4.81)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=weight_nocollege] if survey_firm == "Lucid" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucidwt = r(table_vs)[1,2] if inrange(counter, 5.78, 5.82)
replace l_lucidwt = r(table_vs)[5,2] if inrange(counter, 5.78, 5.82)
replace u_lucidwt = r(table_vs)[6,2] if inrange(counter, 5.78, 5.82)

reg vote_mayor_bin i.corruption_treatment##i.female if survey_firm == "Lucid" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 0.89, 0.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 0.89, 0.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 0.89, 0.91)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 1.89, 1.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 1.89, 1.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 1.89, 1.91)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 2.89, 2.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 2.89, 2.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 2.89, 2.91)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 3.89, 3.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 3.89, 3.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 3.89, 3.91)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 4.89, 4.91)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 4.89, 4.91)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 4.89, 4.91)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Lucid" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_lucid = r(table_vs)[1,2] if inrange(counter, 5.88, 5.92)
replace l_lucid = r(table_vs)[5,2] if inrange(counter, 5.88, 5.92)
replace u_lucid = r(table_vs)[6,2] if inrange(counter, 5.88, 5.92)

reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]   if survey_firm == "Morning Consult" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 0.99, 1.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 0.99, 1.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 0.99, 1.01)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 1.99, 2.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 1.99, 2.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 1.99, 2.01)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 2.99, 3.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 2.99, 3.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 2.99, 3.01)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 3.99, 4.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 3.99, 4.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 3.99, 4.01)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 4.99, 5.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 4.99, 5.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 4.99, 5.01)
reg vote_mayor_bin i.corruption_treatment##i.female [pw=wts]  if survey_firm == "Morning Consult" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mcwt = r(table_vs)[1,2] if inrange(counter, 5.99, 6.01)
replace l_mcwt = r(table_vs)[5,2] if inrange(counter, 5.99, 6.01)
replace u_mcwt = r(table_vs)[6,2] if inrange(counter, 5.99, 6.01)


reg vote_mayor_bin i.corruption_treatment##i.female if survey_firm == "Morning Consult" & countries_new == 1
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 1.09, 1.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 1.09, 1.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 1.09, 1.11)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & countries_new == 2
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 2.09, 2.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 2.09, 2.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 2.09, 2.11)
reg vote_mayor_bin i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 3
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 3.09, 3.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 3.09, 3.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 3.09, 3.11)
reg vote_mayor_bin i.corruption_treatment##i.female  if survey_firm == "Morning Consult" & countries_new == 4
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 4.09, 4.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 4.09, 4.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 4.09, 4.11)
reg vote_mayor_bin i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 5
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 5.09, 5.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 5.09, 5.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 5.09, 5.11)
reg vote_mayor_bin i.corruption_treatment##i.female   if survey_firm == "Morning Consult" & countries_new == 6
margins, dydx(corruption_treatment) at(female=(0(1)1)) pwcompare
replace mean_mc = r(table_vs)[1,2] if inrange(counter, 6.09, 6.11)
replace l_mc = r(table_vs)[5,2] if inrange(counter, 6.09, 6.11)
replace u_mc = r(table_vs)[6,2] if inrange(counter, 6.09, 6.11)

replace counter = . if counter > 6.3
replace counter = . if counter < .7

twoway (scatter counter mean_mc , msymbol(triangle) mcolor(stc3) ) (scatter counter mean_mcwt, msymbol(square) mcolor(stc4)) (scatter counter mean_lucid , msymbol(diamond) mcolor(stc1)) (scatter counter mean_lucidwt , msymbol(Sh) mcolor(stc2)) (rspike l_lucid u_lucid counter, lcolor(black) horizontal) (rspike l_lucidwt u_lucidwt counter, lcolor(black) horizontal)  (rspike l_mc u_mc counter, lcolor(black) horizontal) (rspike l_mcwt u_mcwt counter, lcolor(black) horizontal), legend(order( 1 "MC" 2 "MC (Wt)" 3 "Lucid" 4 "Lucid (Wt)")) xti("") xti("Differential Effect of Corruption Treatment (Women vs. Men)") ylabel(1 "USA" 2 "Philippines" 3 "Nigeria" 4 "Japan" 5 "India" 6 "Brazil") legend(pos(6) rows(1)) yscale(range(.75 6.25))   xline(0) yti("") scale(.7) xlabel(-.50 -.4 -.3 -.2 -.1 0 .1 .2 .3 .4 .5) saving(gender_treatmentbin.gph, replace)

* TESTING WHETHER TREATMENT EFFECTS ARE SIGNIFICANTLY DIFFERENT WITHIN COUNTRY ACROSS PLATFORMS WITH AND WITHOUT WEIGHTS *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

gen corruptionxfemale = corruption_treatment*female
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if brazil==1
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
* Confirm it is same as without interaction *
reg vote_mayor_bin i.corruption_treatment##i.female if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor_bin i.corruption_treatment##i.female if brazil==1 & survey_firm == "Lucid"


reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if usa == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 1
replace l = r(table_vs)[5,2] if counter == 1
replace u = r(table_vs)[6,2] if counter == 1
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if usa == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 2
replace l = r(table_vs)[5,2] if counter == 2
replace u = r(table_vs)[6,2] if counter == 2

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if philippines == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 5
replace l = r(table_vs)[5,2] if counter == 5
replace u = r(table_vs)[6,2] if counter == 5
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if philippines == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 6
replace l = r(table_vs)[5,2] if counter == 6
replace u = r(table_vs)[6,2] if counter == 6

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if nigeria == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 9
replace l = r(table_vs)[5,2] if counter == 9
replace u = r(table_vs)[6,2] if counter == 9
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if nigeria == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 10
replace l = r(table_vs)[5,2] if counter == 10
replace u = r(table_vs)[6,2] if counter == 10

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if japan == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 13
replace l = r(table_vs)[5,2] if counter == 13
replace u = r(table_vs)[6,2] if counter == 13
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if japan == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 14
replace l = r(table_vs)[5,2] if counter == 14
replace u = r(table_vs)[6,2] if counter == 14

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if india == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 17
replace l = r(table_vs)[5,2] if counter == 17
replace u = r(table_vs)[6,2] if counter == 17
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if india == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 18
replace l = r(table_vs)[5,2] if counter == 18
replace u = r(table_vs)[6,2] if counter == 18

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid [pw=weight_combined] if brazil == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 21
replace l = r(table_vs)[5,2] if counter == 21
replace u = r(table_vs)[6,2] if counter == 21
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxfemale##i.lucid female##i.lucid if brazil == 1 
margins, dydx(corruptionxfemale) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 22
replace l = r(table_vs)[5,2] if counter == 22
replace u = r(table_vs)[6,2] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.4 -.3 -.2 -.1 0 .1 .2 .3 .4) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(gender_treatment_diffs_by_platformbin.gph, replace) xti("Difference in Heterogeneous Treatment Effect (Lucid vs. MC)")

graph combine gender_treatmentbin.gph gender_treatment_diffs_by_platformbin.gph

* Figure S3: College Heterogeneity *
* Testing for hetreogeneity across countries *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen mc_diff = .
gen mc_diff_wt = .
gen lucid_diff = .
gen lucid_diff_wt = .
gen l = .
gen u = .

gen corruptionxcollege = corruption_treatment*college
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil==1
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare
* Confirm it is same as without interaction *
reg vote_mayor_bin i.corruption_treatment##i.college if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor_bin i.corruption_treatment##i.college if brazil==1 & survey_firm == "Lucid"

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if usa == 1 & survey_firm == "Lucid" 
replace lucid_diff_wt = r(table)[1,8] if counter == 1
replace l = r(table)[5,8] if counter == 1
replace u = r(table)[6,8] if counter == 1
reg vote_mayor_bin i.corruption_treatment##i.college if usa == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 2
replace l = r(table)[5,8] if counter == 2
replace u = r(table)[6,8] if counter == 2
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if usa == 1 & survey_firm == "Morning Consult" 
replace mc_diff_wt = r(table)[1,8] if counter == 3
replace l = r(table)[5,8] if counter == 3
replace u = r(table)[6,8] if counter == 3
reg vote_mayor_bin i.corruption_treatment##i.college if usa == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 4
replace l = r(table)[5,8] if counter == 4
replace u = r(table)[6,8] if counter == 4

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if philippines == 1  & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 9
replace l = r(table)[5,8] if counter == 9
replace u = r(table)[6,8] if counter == 9
reg vote_mayor_bin i.corruption_treatment##i.college if philippines == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 10
replace l = r(table)[5,8] if counter == 10
replace u = r(table)[6,8] if counter == 10
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if philippines == 1  & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 11
replace l = r(table)[5,8] if counter == 11
replace u = r(table)[6,8] if counter == 11
reg vote_mayor_bin i.corruption_treatment##i.college if philippines == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 12
replace l = r(table)[5,8] if counter == 12
replace u = r(table)[6,8] if counter == 12

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if nigeria == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 17
replace l = r(table)[5,8] if counter == 17
replace u = r(table)[6,8] if counter == 17
reg vote_mayor_bin i.corruption_treatment##i.college if nigeria == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 18
replace l = r(table)[5,8] if counter == 18
replace u = r(table)[6,8] if counter == 18
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if nigeria == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 19
replace l = r(table)[5,8] if counter == 19
replace u = r(table)[6,8] if counter == 19
reg vote_mayor_bin i.corruption_treatment##i.college if nigeria == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 20
replace l = r(table)[5,8] if counter == 20
replace u = r(table)[6,8] if counter == 20

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if japan == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 25
replace l = r(table)[5,8] if counter == 25
replace u = r(table)[6,8] if counter == 25
reg vote_mayor_bin i.corruption_treatment##i.college if japan == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 26
replace l = r(table)[5,8] if counter == 26
replace u = r(table)[6,8] if counter == 26
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if japan == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 27
replace l = r(table)[5,8] if counter == 27
replace u = r(table)[6,8] if counter == 27
reg vote_mayor_bin i.corruption_treatment##i.college if japan == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 28
replace l = r(table)[5,8] if counter == 28
replace u = r(table)[6,8] if counter == 28

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if india == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter == 33
replace l = r(table)[5,8] if counter == 33
replace u = r(table)[6,8] if counter == 33
reg vote_mayor_bin i.corruption_treatment##i.college if india == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 34
replace l = r(table)[5,8] if counter == 34
replace u = r(table)[6,8] if counter == 34
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if india == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter == 35
replace l = r(table)[5,8] if counter == 35
replace u = r(table)[6,8] if counter == 35
reg vote_mayor_bin i.corruption_treatment##i.college if india == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 36
replace l = r(table)[5,8] if counter == 36
replace u = r(table)[6,8] if counter == 36

reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if brazil == 1 & survey_firm == "Lucid"
replace lucid_diff_wt = r(table)[1,8] if counter ==41
replace l = r(table)[5,8] if counter == 41
replace u = r(table)[6,8] if counter == 41
reg vote_mayor_bin i.corruption_treatment##i.college if brazil == 1 & survey_firm == "Lucid"
replace lucid_diff = r(table)[1,8] if counter == 42
replace l = r(table)[5,8] if counter == 42
replace u = r(table)[6,8] if counter == 42
reg vote_mayor_bin i.corruption_treatment##i.college [pw=weight_combined] if brazil == 1 & survey_firm == "Morning Consult"
replace mc_diff_wt = r(table)[1,8] if counter ==43
replace l = r(table)[5,8] if counter == 43
replace u = r(table)[6,8] if counter == 43
reg vote_mayor_bin i.corruption_treatment##i.college if brazil == 1 & survey_firm == "Morning Consult"
replace mc_diff = r(table)[1,8] if counter == 44
replace l = r(table)[5,8] if counter == 44
replace u = r(table)[6,8] if counter == 44

gen obs_pos = counter
replace obs_pos = . if obs_pos>44

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos mc_diff , mcolor(stc3) msymbol(triangle)) ///
    (scatter obs_pos mc_diff_wt, mcolor(stc4) msymbol(square)) ///
    (scatter obs_pos lucid_diff , mcolor(stc1) msymbol(diamond)) ///
    (scatter obs_pos lucid_diff_wt, mcolor(stc2) msymbol(Sh)), ///
	legend(order(2 "MC" 3 "MC (wt)" 4 "Lucid" 5 "Lucid (Wt)") pos(6) rows(1)) ///
	xlabel(-.5 -.4 -.3 -.2 -.1 0 .1 .2 .3) xline(0) ///
    ytitle("") ylabel(42.5 "Brazil" 34.5 "India" 26.5 "Japan" 18.5 "Nigeria" 10.5 "Philippines" 2.5 "USA") ///
    scale(.7) xti("Difference in Treatment Effect (College vs. No-College)") ///
    saving(college_treatment_diffsbin.gph, replace)


* Treatment Effects by Platforms *
use "CFKK_Lucid_MC_Combined.dta", clear
gen weight_combined = .
replace weight_combined = weight_nocollege if survey_firm == "Lucid"
replace weight_combined = wts if survey_firm == "Morning Consult"
svyset [pw=weight_combined]
gen lucid = 0
replace lucid = 1 if survey_firm == "Lucid"
gen counter = _n
gen diff = .
gen diff_wt = .
gen l = .
gen u = .

gen corruptionxcollege = corruption_treatment*college
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil==1
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
* Confirm it is same as without interaction *
reg vote_mayor_bin i.corruption_treatment##i.college if brazil==1 & survey_firm == "Morning Consult"
reg vote_mayor_bin i.corruption_treatment##i.college if brazil==1 & survey_firm == "Lucid"


reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if usa == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 1
replace l = r(table_vs)[5,2] if counter == 1
replace u = r(table_vs)[6,2] if counter == 1
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if usa == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 2
replace l = r(table_vs)[5,2] if counter == 2
replace u = r(table_vs)[6,2] if counter == 2

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if philippines == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 5
replace l = r(table_vs)[5,2] if counter == 5
replace u = r(table_vs)[6,2] if counter == 5
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if philippines == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 6
replace l = r(table_vs)[5,2] if counter == 6
replace u = r(table_vs)[6,2] if counter == 6

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if nigeria == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 9
replace l = r(table_vs)[5,2] if counter == 9
replace u = r(table_vs)[6,2] if counter == 9
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if nigeria == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 10
replace l = r(table_vs)[5,2] if counter == 10
replace u = r(table_vs)[6,2] if counter == 10

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if japan == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 13
replace l = r(table_vs)[5,2] if counter == 13
replace u = r(table_vs)[6,2] if counter == 13
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if japan == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 14
replace l = r(table_vs)[5,2] if counter == 14
replace u = r(table_vs)[6,2] if counter == 14

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if india == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 17
replace l = r(table_vs)[5,2] if counter == 17
replace u = r(table_vs)[6,2] if counter == 17
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if india == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 18
replace l = r(table_vs)[5,2] if counter == 18
replace u = r(table_vs)[6,2] if counter == 18

reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid [pw=weight_combined] if brazil == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff_wt = r(table_vs)[1,2] if counter == 21
replace l = r(table_vs)[5,2] if counter == 21
replace u = r(table_vs)[6,2] if counter == 21
reg vote_mayor_bin i.corruption_treatment##i.lucid corruptionxcollege##i.lucid college##i.lucid if brazil == 1 
margins, dydx(corruptionxcollege) at(lucid=(0(1)1)) pwcompare 
replace diff = r(table_vs)[1,2] if counter == 22
replace l = r(table_vs)[5,2] if counter == 22
replace u = r(table_vs)[6,2] if counter == 22

gen obs_pos = counter
replace obs_pos = . if obs_pos>22

twoway ///
    (rspike u l obs_pos, lcolor(black) horizontal) ///
    (scatter obs_pos diff , mcolor(black) msymbol(circle)) ///
    (scatter obs_pos diff_wt, mcolor(black) msymbol(square)), legend(order(2 "Unweighted" 3 "Weighted") pos(6) rows(1)) ///
	xlabel(-.4 -.3 -.2 -.1 0 .1 .2 .3 .4) xline(0) ///
    ytitle("") ylabel(21.5 "Brazil" 17.5 "India" 13.5 "Japan" 9.5 "Nigeria" 5.5 "Philippines" 1.5 "USA") ///
    scale(.7) ///
    saving(college_treatment_diffs_by_platformbin.gph, replace) xti("Difference in Heterogeneous Treatment Effect (Lucid vs. MC)")

graph combine college_treatment_diffsbin.gph college_treatment_diffs_by_platformbin.gph
	




